Component({
	properties: {
		showModal: Boolean
	},


	data: {

	},

	methods: {
		// 授权登录
		getUserInfo() {
			wx.getUserInfo({
				success: res => {
					const userInfo = res.userInfo
					if (userInfo) {
						this.setData({
							showModal: true
						})
						// 授权成功
						this.triggerEvent('loginsuccess', userInfo)
					} else {
						console.log('拒绝授权')
					}
				},
				fail: err => {
					// console.log(err)
					// 授权失败(拒绝)
					this.triggerEvent('loginfail')
				}
			})
		}
	}
})
